<?php

use yii\db\Migration;

/**
 * Handles the creation of table `user`.
 */
class m190406_044929_create_user_table extends Migration
{
    /**
     * {@inheritdoc}
     */
    public function safeUp()
    {
        $this->createTable('user', [
            'id' => $this->primaryKey(),
            'username' => $this->string(65)->notNull()->comment('用户名'),
            'password_hash' => $this->string(65)->notNull()->comment('密码'),
            'auth_key' => $this->string(65)->notNull()->comment('自动登录key'),
            'password_reset_token' => $this->string(65)->comment('重置密码 token'),
            'email' => $this->string(65)->notNull()->comment('邮箱'),
            'status' => $this->smallInteger(4)->notNull()->defaultValue(10)->comment('状态'),
            'created_at' => $this->integer(11)->notNull()->comment('创建时间'),
            'updated_at' => $this->integer(11)->notNull()->comment('更新时间'),
        ]);
    }

    /**
     * {@inheritdoc}
     */
    public function safeDown()
    {
        $this->dropTable('user');
    }
}
